﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using HB.MsgBus;
namespace FormExample
{
    public partial class AutoLostSubscribeForm : Form
    {
        public AutoLostSubscribeForm()
        {
            InitializeComponent();


        }
      //  MsgCancelToken token = new MsgCancelToken();
        private void AutoLostSubscribeForm_Load(object sender, EventArgs e)
        {

            byte[] data = new byte[1024 * 1024 * 50];
            MsgBus.Subscribe<MsgSigns.TransToForm>(msg =>
            {
                Console.WriteLine(msg);
                //  Console.WriteLine(wr.IsAlive);

                this.Invoke(new Action(() =>
                {
                    this.Text = msg;
                    label2.Text = DateTime.Now.ToString();
                }));


            });
            this.FormClosed += AutoLostSubscribeForm_FormClosed;
        }

        private void AutoLostSubscribeForm_FormClosed(object sender, FormClosedEventArgs e)
        {
            //  token.Dispose();
        }
    }
}
